package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("//prow:def.bzl", "prow_image")

NAME = "configurator"

go_binary(
    name = NAME,
    embed = [":go_default_library"],
    pure = "on",
)

prow_image(
    name = "image",
    component = NAME,
)

go_test(
    name = "go_default_test",
    srcs = [
        "main_test.go",
        "prow_test.go",
    ],
    data = [
        "//config:prowjobs",
        "//config:testgrids",
        "//config/prow:config.yaml",
    ],
    embed = [":go_default_library"],
    deps = [
        "//prow/apis/prowjobs/v1:go_default_library",
        "//prow/config:go_default_library",
        "@com_github_googlecloudplatform_testgrid//config/yamlcfg:go_default_library",
        "@com_github_googlecloudplatform_testgrid//pb/config:go_default_library",
    ],
)

go_library(
    name = "go_default_library",
    srcs = [
        "main.go",
        "prow.go",
    ],
    importpath = "k8s.io/test-infra/testgrid/cmd/configurator",
    deps = [
        "//prow/apis/prowjobs/v1:go_default_library",
        "//prow/config:go_default_library",
        "//prow/pod-utils/downwardapi:go_default_library",
        "//prow/pod-utils/gcs:go_default_library",
        "@com_github_googlecloudplatform_testgrid//config:go_default_library",
        "@com_github_googlecloudplatform_testgrid//config/yamlcfg:go_default_library",
        "@com_github_googlecloudplatform_testgrid//pb/config:go_default_library",
        "@com_github_googlecloudplatform_testgrid//util/gcs:go_default_library",
        "@com_github_sirupsen_logrus//:go_default_library",
        "@com_google_cloud_go_storage//:go_default_library",
        "@io_k8s_sigs_yaml//:go_default_library",
    ],
)

filegroup(
    name = "package-srcs",
    srcs = glob(["**"]),
    tags = ["automanaged"],
    visibility = ["//visibility:private"],
)

filegroup(
    name = "all-srcs",
    srcs = [":package-srcs"],
    tags = ["automanaged"],
)
